﻿namespace NEvoWeb.Modules.NB_Store
{
    using DotNetNuke.Common;
    using DotNetNuke.Entities.Modules;
    using System;
    using System.Diagnostics;

    public class BaseAdmin : BaseModule
    {
        [DebuggerNonUserCode]
        public BaseAdmin()
        {
            base.Init += new EventHandler(this.Page_Init);
        }

        public string EditUrl()
        {
            return this.EditUrl("", "", "Edit");
        }

        public string EditUrl(string ControlKey)
        {
            return this.EditUrl("", "", ControlKey);
        }

        public string EditUrl(string KeyName, string KeyValue)
        {
            return this.EditUrl(KeyName, KeyValue, "Edit");
        }

        public string EditUrl(string KeyName, string KeyValue, string ControlKey)
        {
            string controlKey = ControlKey;
            string str3 = "";
            if (this.Request.QueryString["SkinSrc"] != null)
            {
                str3 = Globals.QueryStringEncode(this.Request.QueryString["SkinSrc"]);
            }
            if (controlKey == "")
            {
                controlKey = "Edit";
            }
            if ((KeyName != "") & (KeyValue != ""))
            {
                if (str3 == "")
                {
                    return Globals.NavigateURL(this.PortalSettings.ActiveTab.TabID, controlKey, new string[] { "mid=" + this.ModuleId.ToString(), KeyName + "=" + KeyValue });
                }
                return Globals.NavigateURL(this.PortalSettings.ActiveTab.TabID, controlKey, new string[] { "mid=" + this.ModuleId.ToString(), KeyName + "=" + KeyValue, "SkinSrc=" + str3 });
            }
            if (str3 == "")
            {
                return Globals.NavigateURL(this.PortalSettings.ActiveTab.TabID, controlKey, new string[] { "mid=" + this.ModuleId.ToString() });
            }
            return Globals.NavigateURL(this.PortalSettings.ActiveTab.TabID, controlKey, new string[] { "mid=" + this.ModuleId.ToString(), "SkinSrc=" + str3 });
        }

        public string EditUrl(string KeyName, string KeyValue, string ControlKey, params string[] AdditionalParameters)
        {
            PortalModuleBase base2 = new PortalModuleBase();
            string str3 = "";
            if (this.Request.QueryString["SkinSrc"] != null)
            {
                str3 = Globals.QueryStringEncode(this.Request.QueryString["SkinSrc"]);
            }
            string controlKey = ControlKey;
            if (controlKey == "")
            {
                controlKey = "Edit";
            }
            if ((KeyName != "") & (KeyValue != ""))
            {
                string[] strArray = new string[(AdditionalParameters.Length + 2) + 1];
                strArray[0] = "mid=" + this.ModuleId.ToString();
                strArray[1] = KeyName + "=" + KeyValue;
                if (str3 != "")
                {
                    strArray[2] = "SkinSrc=" + str3;
                }
                int num4 = AdditionalParameters.Length - 1;
                for (int j = 0; j <= num4; j++)
                {
                    strArray[j + 3] = AdditionalParameters[j];
                }
                return Globals.NavigateURL(this.PortalSettings.ActiveTab.TabID, controlKey, strArray);
            }
            string[] additionalParameters = new string[(AdditionalParameters.Length + 1) + 1];
            additionalParameters[0] = "mid=" + this.ModuleId.ToString();
            if (str3 != "")
            {
                additionalParameters[1] = "SkinSrc=" + str3;
            }
            int num5 = AdditionalParameters.Length - 1;
            for (int i = 0; i <= num5; i++)
            {
                additionalParameters[i + 2] = AdditionalParameters[i];
            }
            return Globals.NavigateURL(this.PortalSettings.ActiveTab.TabID, controlKey, additionalParameters);
        }

        private void Page_Init(object sender, EventArgs e)
        {
            SharedFunctions.IncludeScripts(this.PortalId, base.StoreInstallPath, this.Page, "adminjs.includes", "adminstartup.includes", "admincss.includes");
        }
    }
}

